/*
** main.c for 42sh in /home/demesy_j/svn/quarante-deuxsh/trunk
** 
** Made by julien demesy
** Login   <demesy_j@epitech.net>
** 
** Started on  Tue Mar 13 15:22:09 2012 julien demesy
** Last update Fri Mar 16 14:44:45 2012 julien demesy
*/

#include	<stdlib.h>
#include	<stdio.h>
#include	<signal.h>
#include	<string.h>
#include	"execute.h"
#include	"prompt.h"
#include	"list.h"

extern	char	**environ;

int		check_line(char *line)
{
  int		i;

  i = 0;
  while (line[i] != '\n')
    {
      if (line[i] != ' ' && line[i] != '\t')
	return (1);
      i++;
    }
  return (0);
}

int		main()
{
  char		*line;
  t_list	*env;

  signal(SIGINT, SIG_IGN);
  welcome();
  env = create_env_list(environ);
  while (1)
    {
      line = prompt(env);
      if (check_line(line) == 1)
	{
	  if (strlen(line) > 0)
	    interprete(line, env);
	}
      free(line);
    }
  return (0);
}
